package com.chaofan.authsso.core.properties;

import cn.hutool.core.util.StrUtil;
import com.chaofan.authsso.core.common.CacheType;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * authsso配置实体类
 * Author: Chaofan
 * Date: 2020/6/4 14:25
 * email: chaofan2685@qq.com
 */
@ConfigurationProperties("authsso.core")
public class SsoCoreProperties {

    //登录页
    private String loginHtml = "/login.html";

    //缓存类型
    private String cacheType = CacheType.LOCAL.getType();

    private long expiresTime = 1800;

    public long getExpiresTime() {
        return expiresTime;
    }

    public void setExpiresTime(long expiresTime) {
        this.expiresTime = expiresTime;
    }

    public String getLoginHtml() {
        return loginHtml;
    }

    public void setLoginHtml(String loginHtml) {
        this.loginHtml = loginHtml;
    }

    public String getCacheType() {
        return cacheType;
    }

    public void setCacheType(String cacheType) {
        if (StrUtil.equalsIgnoreCase(CacheType.LOCAL.getType(),cacheType) || StrUtil.equalsIgnoreCase(CacheType.REDIS.getType(),cacheType)){
            this.cacheType = cacheType;
        }
    }
}
